﻿@{
    Layout = "~/views/shared/_LayoutMember.cshtml";
    ViewBag.Title = "Register";
    var Member = Session["LoginUser"] as Domain.Model.User;
}
@model Domain.Model.User

@section HeadScript{
    <script type="text/javascript" src="~/inc/common.js"></script>
    <link href="~/Content/validBox/validBox.css" rel="stylesheet" />
    <script src="~/Content/validBox/validBox.js"></script>
    <link href="~/Content/window/window.css" rel="stylesheet" />
    <script src="~/Content/window/window.js"></script>
}

<form class="form-horizontal">
    <div class="fr2 green fs-25 Tbrline">新会员注册</div>
    <div class="fr2">
        <div class="tu-title">&raquo;&nbsp;注册位置</div>
        <div class="ui-row">
            <div class="ui-row-tt">推荐人：</div>
            <div class="ui-row-con">
                @Html.TextBox("Referrer", @Member.Account, new { @class = "input-tt iw200", @Readonly = "Readonly" })
            </div>
            <div class="ui-row-ts"><span>*</span></div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">接点人：</div>
            <div class="ui-row-con">
                @Html.TextBoxFor(i => i.ContactPerson, Html.ValidFor(i => i.ContactPerson))
            </div>
            <div class="ui-row-ts">
                <span>*</span><a href="javascript:void(0);" onclick="Search()">[ 查找安置人空位 ]
                </a>安置人必须在推荐人网络内
            </div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">位置：</div>
            <div class="ui-row-con">
                @Html.DropDownListFor(item => item.Position, new SelectList(Model.Position.GetNameDisplays(), "Key", "Value"), new { @class = "input-tt" })
            </div>
            <div class="ui-row-ts"></div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">会员级别：</div>
            <div class="ui-row-con">
                @Html.DropDownListFor(item => item.Level, new SelectList(Model.Level.GetNameDisplays(), "Key", "Value"), new { @class = "input-tt" })
            </div>
            <div class="ui-row-ts"></div>
        </div>
        <div class="tu-title">&raquo;&nbsp;个人资料</div>
        <div class="ui-row">
            <div class="ui-row-tt">会员编号：</div>
            <div class="ui-row-con">
                @Html.TextBoxFor(i => i.Account,Html.ValidFor(i=>i.Account))
            </div>
            <div class="ui-row-ts"><span>*</span></div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">昵称：</div>
            <div class="ui-row-con">
                @Html.TextBoxFor(i => i.NickName, Html.ValidFor(i => i.NickName))
            </div>
            <div class="ui-row-ts"><span>*</span></div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">姓名：</div>
            <div class="ui-row-con">
                @Html.TextBoxFor(i => i.Name, Html.ValidFor(i => i.Name))
            </div>
            <div class="ui-row-ts"><span>*</span>不能少于两位数</div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">性别：</div>
            <div class="ui-row-con">
                @Html.DropDownListFor(item => item.Gender, new SelectList(Model.Gender.GetNameDisplays(), "Key", "Value"), new { @class = "input-tt" })
            </div>
            <div class="ui-row-ts"></div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">地址：</div>
            <div class="ui-row-con">
                @Html.TextAreaFor(i => i.Address, new { @class = "input-tt" })
            </div>
            <div class="ui-row-ts"></div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">手机号码：</div>
            <div class="ui-row-con">
                @Html.TextBoxFor(i => i.TelPhone, Html.ValidFor(i => i.TelPhone))
            </div>
            <div class="ui-row-ts"><span>*</span>由6位以上数字和字母组成</div>
        </div>
        <div class="tu-title">&raquo;&nbsp;安全信息</div>
        <div class="ui-row">
            <div class="ui-row-tt">一级密码：</div>
            <div class="ui-row-con">
                @Html.PasswordFor(i => i.Password, Html.ValidFor(i => i.Password))
            </div>
            <div class="ui-row-ts"><span>*</span>由6位以上数字和字母组成</div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">登录密码确认：</div>
            <div class="ui-row-con">
                @Html.Password("RePassword", Model.Password, Html.Valid().Required().EqualTo("Password", "两次密码不一致").AsHtmlAttribute())
            </div>
            <div class="ui-row-ts"><span>*</span>请重复输入你的登录密码</div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">交易密码：</div>
            <div class="ui-row-con">
                @Html.PasswordFor(item => item.ExchangePassword, Html.ValidFor(item => item.ExchangePassword))
            </div>
            <div class="ui-row-ts"><span>*</span>由6位以上数字和字母组成</div>
        </div>
        <div class="ui-row">
            <div class="ui-row-tt">交易密码确认：</div>
            <div class="ui-row-con">
                @Html.Password("ReExchangePassword", Model.ExchangePassword, Html.Valid().Required().EqualTo("ExchangePassword", "两次密码不一致").AsHtmlAttribute())
            </div>
            <div class="ui-row-ts"><span>*</span>请重复输入你的交易密码</div>
        </div>
        <div class="ui-row ui-row-sbtn">
            <input type="button" value="提 交" class="sbtn" onclick="saveForm()" />
        </div>
    </div>
    @Html.HiddenFor(i => i.RoleId)
</form>
@section Script
{

    @*提交*@
    <script type="text/javascript">
        function saveForm() {
            $('form').validBox(function (r) {
                if (r == false)
                    return;

                $.post("/Member/Register/", $('form').serialize(), function (data) {
                    if (data.state) {
                        window.messageBox('提示', '注册成功');
              
                        location.href = "/member/ActivateMember";
                    }
                    else {
                        window.messageBox('提示', data.value);
                    }
                });
            });
        }
    </script>
}


